"""
=================================================
@Author: Zhenzhou Liu
@Date: 2025-01-10
@Description：
==================================================
"""
class queue_using_stack:

    def __init__(self):
        self.inStack = []
        self.outStack = []
        

    def push(self, x: int) -> None:
        self.inStack.append(x)

    def pop(self) -> int:
        if not self.outStack:
            self.in2out()
        x = self.outStack[-1]
        self.outStack.pop()
        return x

    def peek(self) -> int:
        if not self.outStack:
            self.in2out()
        return self.outStack[-1]
        

    def empty(self) -> bool:
        return not self.inStack and not self.outStack

    def in2out(self):
        while self.inStack:
            self.outStack.append(self.inStack[-1])
            self.inStack.pop()

if __name__ == '__main__':
    que = queue_using_stack()
    que.push(1)
    que.push(2)
    print(que.peek())
    print(que.pop())
    print(que.empty())